using Unity.VisualScripting;
using UnityGameFramework.Runtime;

namespace LS.UGFUnits
{
    [UnitShortTitle("Unload Scene")]
    [UnitSurtitle("Failure")]
    public sealed class UnloadSceneFailure : FrameworkEventUnit<UnloadSceneFailureEventArgs>
    {
        protected override int EventId => UnloadSceneFailureEventArgs.EventId;
        protected override string HookName => UGFHookNames.UnloadSceneFailure;

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput SceneAssetName
        {
            get;
            private set;
        }

        [DoNotSerialize]
        [PortLabelHidden]
        public ValueOutput UserData { get; private set; }

        protected override void Definition()
        {
            base.Definition();
            SceneAssetName = ValueOutput<string>(nameof(SceneAssetName));
            UserData = ValueOutput<object>(nameof(UserData));
        }

        protected override void AssignArguments(Flow flow, UnloadSceneFailureEventArgs args)
        {
            base.AssignArguments(flow, args);
            flow.SetValue(SceneAssetName, args.SceneAssetName);
            flow.SetValue(UserData, args.UserData);
        }
    }
}